﻿using OperationPlugins;
using Demo.Model;
using System;
using OperationPlugins.Validators;

namespace Demo.Validators
{
    /// <summary>
    /// 
    /// </summary>
    [ValidatorOf(ValidationLevel.Level1, typeof(Employee))]
    public class SampleValidator1 : IValidator
    {
        public ValidationResultMessageContainer Validate(object value, OperationContext context)
        {
            return ValidationResultMessageContainer.Success;
        }
    }

    /// <summary>
    /// 
    /// </summary>
    [ValidatorOf(ValidationLevel.Level2, typeof(Employee))]
    public class SampleValidator2 : IValidator
    {
        public ValidationResultMessageContainer Validate(object value, OperationContext context)
        {
            return ValidationResultMessageContainer.Success;
        }
    }

    /// <summary>
    /// 
    /// </summary>
    [ValidatorOf(ValidationLevel.Level3, typeof(Employee))]
    public class SampleValidator3 : IValidator
    {
        public ValidationResultMessageContainer Validate(object value, OperationContext context)
        {
            ValidationResultMessageContainer result = new ValidationResultMessageContainer();

            ValidationResultMessage message1 = new ValidationResultMessage(ValidationLevel.Level3, "Töttöröö!!!! " + DateTime.Now.ToLongTimeString());
            result.Add(message1);

            ValidationResultMessage message2 = new ValidationResultMessage(ValidationLevel.Level3, "Pööö!!!!");
            result.Add(message2);

            ValidationResultMessage message3 = new ValidationResultMessage(ValidationLevel.Level3, "Pööö!!!!.......");
            result.Add(message3);

            return result;
        }
    }

    ///// <summary>
    ///// 
    ///// </summary>
    //[ValidatorOf(ValidationLevel.Level3, typeof(Employee))]
    //public class SampleValidator4 : AbstractValidator
    //{
    //    protected new Employee Value
    //    {
    //        get
    //        {
    //            return (Employee)base.Value;
    //        }
    //    }

    //    protected override void Validate()
    //    {
    //    }
    //}

    /// <summary>
    /// 
    /// </summary>
    [ValidatorOf(ValidationLevel.Level2, typeof(Employee))]
    [Ignore]
    public class SampleValidator5 : IValidator
    {
        public ValidationResultMessageContainer Validate(object value, OperationContext context)
        {
            ValidationResultMessageContainer result = new ValidationResultMessageContainer();

            ValidationResultMessage message = new ValidationResultMessage(ValidationLevel.Level2, "Tämä on liiketoimintavirhe!!!!");

            result.Add(message);

            return result;
        }
    }

    ///// <summary>
    ///// 
    ///// </summary>
    //[ValidatorOf(ValidationLevel.Level3, typeof(Employee))]
    //public class SampleValidator6 : AbstractValidator
    //{
    //    protected new Employee Value
    //    {
    //        get
    //        {
    //            return (Employee)base.Value;
    //        }
    //    }

    //    protected override void Validate()
    //    {


    //    }
    //}


}
